<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui" template="/pages/template.xhtml">

    <ui:define name="screen">

        <h:form prependId="false" id="cadastroPermissao">

            <p:growl id="growl" />
            <p:focus /> 

            <p:panel header="Cadastro de Permissão" >

                <h:panelGrid columns="1" id="grid" >

                    <h:outputLabel for="Id" value="Permissao" />
                    <p:commandButton image="ui-icon ui-icon-extlink" title="Consultar" tabindex="-1" ajax="false"  
                                     action="#{cadastroPermissaoAction.consultaPermissao}" >            
                        <p:inputText id="id" readonly="true"
                                     value="#{cadastroPermissaoAction.cadastroPermissaoVo.permissaoVo.id}" />
                    </p:commandButton>
                    <p:message for="id" />

                </h:panelGrid>


                <p:commandButton value="Salvar" image="ui-icon ui-icon-disk" title="Salvar" ajax="false" update="grid,growl"
                                 action="#{cadastroPermissaoAction.salvar}" />
                
                <p:commandButton value="Deletar" image="ui-icon ui-icon-trash" title="Deletar" process="@this" tabindex="-1"
                                 onclick="confirmarExclusaoPermissao.show()" />                    
                
                <p:commandButton image="ui-icon ui-icon-refresh" title="Limpar" update="grid" process="@this" tabindex="-1"
                                 action="#{cadastroPermissaoAction.limpar}" />
                
            </p:panel>

        </h:form>

        <h:form>
            <p:commandButton value="Principal" image="ui-icon ui-icon-home" title="Principal" ajax="false" action="principal" />          
        </h:form> 
        
        <h:form id="formConfirmarExclusaoPermissao">
            <p:confirmDialog widgetVar="confirmarExclusaoPermissao" 
                             message="Confirmar exclusao?" 
                             severity="alert" 
                             modal="true" 
                             header="Confirmar" >
                
                <p:commandButton id="btnSim" value="Sim" 
                                 oncomplete="confirmarExclusaoPermissao.hide()" 
                                 actionListener="#{cadastroPermissaoAction.deletar}"
                                 action="#{consultaPermissaoAction.filtrar}"
                                 update="grid,growl" />
                
                <p:commandButton id="btnNao" value="Não" 
                                 onclick="confirmarExclusaoPermissao.hide()" />
                
            </p:confirmDialog>
        </h:form>

    </ui:define>

</ui:composition>
